package com.hmall.order.web;

import com.hmall.order.dto.OrderDTO;
import com.hmall.order.pojo.Order;
import com.hmall.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
public class OrderController {

   @Autowired
   private IOrderService orderService;

   /**
    * 创建订单
    * @param orderDTO
    * @return
    */
   @PostMapping
   public String createOrder(@RequestBody OrderDTO orderDTO) {
        Order order = orderService.createOrder(orderDTO);
      String orderId = order.getId().toString();
      return orderId ;
   }
}
